SUMMARY = "Generic Linux command-line automation tool"
HOMEPAGE = "https://github.com/ReimuNotMoe/ydotool"
LICENSE = "Apache-2.0 & MIT"
LIC_FILES_CHKSUM = " \
    file://LICENSE;md5=eb1e647870add0502f8f010b19de32af \
"

PV = "v1.0.4"
SRC_URI = "git://github.com/ReimuNotMoe/ydotool.git;protocol=https;nobranch=1;branch=${PV};"
SRCREV = "57ba7d0af525e82da2de0e275d169477f293b197"

S = "${WORKDIR}/git"

inherit cmake pkgconfig

# 自定义配置任务，完全控制 CMake 命令
do_configure() {
    ${STAGING_BINDIR_NATIVE}/cmake -B ${B}/build/ "-DBUILD_DOCS=OFF -DSYSTEMD_USER_SERVICE=ON -DSYSTEMD_SYSTEM_SERVICE=ON -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake -DCMAKE_INSTALL_PREFIX=${prefix}" -S ${S}
}

# 编译和安装任务
do_compile() {
    cd ${B}/build
    ${STAGING_BINDIR_NATIVE}/make VERBOSE=1 ydotool ydotoold
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755 ${B}/build/ydotool ${D}${bindir}/
    install -m 0755 ${B}/build/ydotoold ${D}${bindir}/
}

# 包内容定义
FILES:${PN} = " \
    ${bindir}/ydotool \
    ${bindir}/ydotoold \
"
